package chapter3.No3_1_等待和通知机制.g方法wait_long的使用;

/**
 * Created by Administrator on 2016/11/17.
 */
public class ThreadA extends Thread {
    Object lock;

    public ThreadA(Object lock) {
        this.lock = lock;
    }

    @Override
    public void run() {
        synchronized (lock) {
            try {
                System.out.println(Thread.currentThread().getName() + " 开始" + System.currentTimeMillis());
                lock.wait(4000);
                System.out.println(Thread.currentThread().getName() + " 结束" + System.currentTimeMillis());
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
